package com.rober.algorithm;

/**
 * @For: 递归算法
 * @author roberluo
 *
 */

public class Recursive {
	
	public static void main(String[] args) {
		System.out.println(sum(100));
	}
	

	public static int sum(int i) {
		// 如果等于1跳出循环
		if (i == 1) {
			return 1;
		}
		// System.out.println(i);
		return i + sum(i - 1);

	}
}
